import { createRouter, createWebHashHistory } from 'vue-router'

const Layout = () => import('@/views/Layout')
const Home = () => import('@/views/Home')
const routes = [
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '/',
        component: Home
      },
      {
        path: '/goods/:id',
        component: () => import('@/views/Goods')
      },
      {
        path: '/cart',
        component: () => import('@/views/Cart')
      },
      {
        path: '/order',
        component: () => import('@/views/Member/Order')
      },
      {
        path: '/settled',
        component: () => import('@/views/Member/settled')
      },
      {
        path: '/pay',
        component: () => import('@/views/Member/pay')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/Login')
  }

]

const router = createRouter({
  history: createWebHashHistory(),
  routes,
  scrollBehavior () { return { left: 0, top: 0 } }
})

export default router
